/**
 * 
 */
package com.HibernateRecepies.DAO;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;

import com.Hib.Util.SessionManager;
import com.HibernateRecepies.Domain.Video_Disc;

/**
 * @author Ignatiues charles arun
 * 
 *         Dec 10, 2010
 */
public class DisDAO
	{

		private static SessionFactory sessionFactory;

		private static Session session;

		/**
		 * @param args
		 */
		public static void main(String[] args)
			{
				// TODO Auto-generated method stub
				sessionFactory = SessionManager.getSessionfactory();
				session = sessionFactory.getCurrentSession();

				if (session == null)
					{
						session.clear();

					} else
					{
						Transaction tx = session.beginTransaction();

						Video_Disc vdDsc = new Video_Disc();
						vdDsc.setDirector("James Cameroon");
						vdDsc.setLanguage("English");
						vdDsc.setId(10);
						vdDsc.setName("AVATHOR");
						vdDsc.setPrice(930);
						// Disc dsc = new Disc();
						// dsc.setId(10);
						// dsc.setName("Jurasic Park");
						// dsc.setPrice(390);
						// session.save(dsc);
						session.flush();
						session.save(vdDsc);
						session.flush();
						tx.commit();
					}

			}
	}
